home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / ubiquity / base-installer / kernel.sh
Text File  |  2009-10-28  |  3KB  |  115 lines

  1. arch_get_kernel_flavour () {
  2.     VENDOR=`grep '^vendor_id' "$CPUINFO" | head -n1 | cut -d: -f2`
  3.     FAMILY=`grep '^cpu family' "$CPUINFO" | head -n1 | cut -d: -f2`
  4.     MODEL=`grep '^model[[:space:]]*:' "$CPUINFO" | head -n1 | cut -d: -f2`
  5.  
  6.     # Only offer bigmem if the system supports PAE and the
  7.     # installer itself is already using a bigmem kernel.
  8.     if grep '^flags' "$CPUINFO" | grep -q pae ; then
  9.         case "$KERNEL_FLAVOUR" in
  10.         686-bigmem*|generic-pae|xen) BIGMEM="-bigmem" ;;
  11.         *) BIGMEM="-may-bigmem" ;;
  12.         esac
  13.     fi
  14.  
  15.     # On systems with 3GB or more of RAM, PAE is needed to access it all.
  16.     if [ "x$BIGMEM" = "x-may-bigmem" ] && \
  17.        [ "$MEMTOTAL" ] && [ "$MEMTOTAL" -gt 3145728 ]; then
  18.         BIGMEM="-bigmem"
  19.     fi
  20.  
  21.     case "$VENDOR" in
  22.         " AuthenticAMD"*)
  23.         case "$FAMILY" in
  24.             " 15"|" 16"|" 17")            # k8
  25.             echo 686$BIGMEM
  26.             ;;
  27.             " 6")                # k7
  28.             case "$MODEL" in
  29.                 " 0"|" 1"|" 2"|" 3"|" 4"|" 5")
  30.                 # May not have SSE support
  31.                 echo 586 ;;
  32.                 *)    echo 686$BIGMEM ;;
  33.             esac
  34.             ;;
  35.             " 5")                # k6
  36.             echo 586
  37.             ;;
  38.             *)        echo 486 ;;
  39.         esac
  40.         ;;
  41.         " GenuineIntel")
  42.         case "$FAMILY" in
  43.             " 6"|" 15")    echo 686$BIGMEM ;;
  44.             " 5")    echo 586 ;;
  45.             *)        echo 486 ;;
  46.         esac
  47.         ;;
  48.         " GenuineTMx86"*)
  49.         case "$FAMILY" in
  50.             " 5"|" 6"|" 15")    echo 586 ;;
  51.             *)            echo 486 ;;
  52.         esac
  53.         ;;
  54.         " CentaurHauls")
  55.         case "$FAMILY" in
  56.             " 6")
  57.             case "$MODEL" in
  58.                 " 9"|" 10")    echo 686$BIGMEM ;;
  59.                 *)        echo 586 ;;
  60.             esac
  61.             ;;
  62.             *)
  63.             echo 486 ;;
  64.         esac
  65.         ;;
  66.         *)
  67.         echo 486 ;;
  68.     esac
  69.     return 0
  70. }
  71.  
  72. # Note: the -k7 flavor has been dropped with linux-2.6 (2.6.23-1)
  73.  
  74. arch_check_usable_kernel () {
  75.     if echo "$1" | grep -Eq -- "-386(-.*)?$"; then return 0; fi
  76.     if [ "$2" = 486 ]; then return 1; fi
  77.     if echo "$1" | grep -Eq -- "-(generic|virtual|rt)(-.*)?$" && ! echo "$1" | grep -Eq -- "-generic-pae(-.*)?$"; then return 0; fi
  78.     if [ "$2" = 586 ] || [ "$2" = 686 ]; then return 1; fi
  79.     if echo "$1" | grep -Eq -- "-(generic-pae|xen)(-.*)?$"; then return 0; fi
  80.     if [ "$2" = 686-may-bigmem ] || [ "$2" = 686-bigmem ]; then return 1; fi
  81.  
  82.     # default to usable in case of strangeness
  83.     warning "Unknown kernel usability: $1 / $2"
  84.     return 0
  85. }
  86.  
  87. arch_get_kernel () {
  88.     imgbase=linux-image
  89.  
  90.     # See older versions of script for more flexible code structure
  91.     # that allows multiple levels of fallbacks
  92.     if [ "$1" = 686-bigmem ]; then
  93.         echo "linux-generic-pae"
  94.         echo "linux-image-generic-pae"
  95.         echo "linux-xen"
  96.         echo "linux-image-xen"
  97.     fi
  98.     if [ "$1" = 686-bigmem ] || [ "$1" = 686-may-bigmem ] || [ "$1" = 686 ] || [ "$1" = 586 ]; then
  99.         echo "linux-generic"
  100.         echo "linux-image-generic"
  101.         echo "linux-virtual"
  102.         echo "linux-image-virtual"
  103.         echo "linux-rt"
  104.         echo "linux-image-rt"
  105.     fi
  106.     if [ "$1" = 686-may-bigmem ]; then
  107.         echo "linux-generic-pae"
  108.         echo "linux-image-generic-pae"
  109.         echo "linux-xen"
  110.         echo "linux-image-xen"
  111.     fi
  112.     echo "linux-386"
  113.     echo "linux-image-386"
  114. }
  115.